Load tiffs without gdk-pixbuf
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Sep 2021 20:30:37 +0000 (16:30 -0400)
committerBenjamin Otte <otte@redhat.com>
Thu, 16 Sep 2021 22:25:22 +0000 (00:25 +0200)
This will let us load floating point data, in
the future.

gdk/gdktexture.c

index 85b5be28bb68be4a67d16740ba55bba04257cd00..4176552df846c48c1b341bb7b7edf277a5547bce 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <graphene.h>
 #include "loaders/gdkpngprivate.h"
+#include "loaders/gdktiffprivate.h"
 
 G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
 
@@ -437,6 +438,13 @@ gdk_texture_new_from_bytes (GBytes  *bytes,
     {
       return gdk_load_png (bytes, error);
     }
+  else if ((size > strlen (TIFF_SIGNATURE1) &&
+            memcmp (data, TIFF_SIGNATURE1, strlen (TIFF_SIGNATURE1)) == 0) ||
+           (size > strlen (TIFF_SIGNATURE2) &&
+            memcmp (data, TIFF_SIGNATURE2, strlen (TIFF_SIGNATURE2)) == 0))
+    {
+      return gdk_load_tiff (bytes, error);
+    }
   else
     {
       GInputStream *stream;